home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 040 (1987-11-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 040 (1987-11-15)(Ossowski, Stefan)(DE)(PD).adf / SimCPM / simcpm.doc < prev    next >
Text File  |  1989-01-18  |  8KB  |  159 lines

  1.                  SIMCPM - a CP/M simulator for the Amiga
  2.  
  3.                      by Jim Cathey and Charlie Gibbs
  4.  
  5.                     Version 1.00 - September 15, 1987
  6.  
  7.  
  8.      This is a FREELY-DISTRIBUTABLE program.  Spread it around all you like,
  9. just don't sell it, and please keep the entire package (including this file)
  10. intact.  If you find any bugs or make any changes, please let me know - I'd
  11. like to keep my copy up to date.
  12.  
  13.      This program is based on an article by Jim Cathey which ran in Dr. Dobb's
  14. Journal from January to March 1986.  The original program emulated an 8080,
  15. including CP/M BIOS and BDOS calls, on a CP/M-68K system.  I have modified the
  16. operating system interface to run under AmigaDOS (from the CLI only).
  17.  
  18.      Note that the simulation is of an 8080, not a Z80.  However, the Z80
  19. instructions LDIR, LDDR, and CPIR have been supported.  This is because the
  20. setting of the carry flag is more like the Z80 than the 8080, and might fool
  21. such packages as BDS C, which would then try to use these instructions.  If
  22. there is enough interest, I could be persuaded to add full Z80 support.
  23.  
  24.      The IN, OUT, EI, and DI instructions are currently ignored.
  25.  
  26.      The following BDOS calls are not supported:
  27.  
  28.           3 - reader input
  29.           4 - punch output
  30.          17 - search for first file
  31.          18 - search for next file
  32.          24 - get active drive map
  33.          all above 26 except random read (33) and random write (34)
  34.  
  35.      The only BIOS calls supported are those for program termination and
  36. console and list I/O.  (Low-level disk access could get scary.)  If a
  37. program attempts to use an unsupported BIOS or BDOS call, an appropriate
  38. error message will be displayed, along with a register dump, and the program
  39. will be terminated.
  40.  
  41.      Basic H19 terminal emulation (similar to a VT52) has been provided.
  42. Escape sequences for cursor positioning, cursor to home, screen clearing,
  43. and insert and delete modes are translated to the corresponding Amiga
  44. sequences.  The program MANDOG.COM, which I wrote for my original CP/M
  45. (H19) system and copied here unchanged, demonstrates the cursor addressing
  46. capabilities of SIMCPM.  Any escape sequences that SIMCPM can't recognize
  47. are passed through unchanged.  You can disable all escape sequence trans-
  48. lation by changing the equated value "h19" (in SIMCPM1.ASM) to from 1 to 0.
  49.  
  50.      To speed up console output for programs which write one character at a
  51. time, I have included a buffered output option.  If you include the -b switch
  52. as the first command-line parameter, all console output will be held until one
  53. of the following events occurs:
  54.  
  55.           - a carriage return, line feed, or bell character is written
  56.           - the buffer (currently 2K) becomes full
  57.           - a BIOS or BDOS call other than console output is made.
  58.  
  59. It should be possible to use buffered output in just about any program.
  60. Note that if a program uses the "console output string" function (BDOS
  61. call 9), the entire string is written in a single operation even when
  62. buffering is not requested.
  63.  
  64.      List output is sent to PRT:RAW.  This ensures that no newline translation
  65. will take place.  The printer is not opened until the first attempt is made to
  66. access it.  If the printer cannot be opened for any reason, the program will be
  67. terminated.  At program termination the printer will be closed if it was used.
  68.  
  69.      If SIMCPM is brought up with no command-line parameters, it will present
  70. the standard CP/M A> prompt.  At this point you can run CP/M .COM files just
  71. like on a normal CP/M system.  The command line will be scanned for up to two
  72. FCBs and the tail will be passed to the program.  When the program terminates,
  73. the A> prompt will be re-displayed.  To return to AmigaDOS, enter a control-C
  74. (CP/M warm boot) at the A> prompt.
  75.  
  76.      If command-line parameters are given, they will be passed to SIMCPM as if
  77. they had been entered at the A> prompt.  When the program terminates, SIMCPM
  78. will automatically return to AmigaDOS.  This allows you to run CP/M programs
  79. from an execute file.
  80.  
  81.      Here are some sample invocations of SIMCPM:
  82.  
  83.           simcpm
  84.                Loads the simulator, which presents the A> prompt and waits
  85.                for CP/M commands.  Type control-C at the prompt to exit.
  86.  
  87.           simcpm -b
  88.                Same as above, except console output buffering is used.
  89.  
  90.           simcpm myprog
  91.                Loads the simulator, which loads and runs the CP/M program
  92.                MYPROG.COM.  When MYPROG terminates, SIMCPM returns to AmigaDOS.
  93.  
  94.           simcpm mbasic basprog
  95.                Loads the simulator, which loads Microsoft BASIC-80 (if you
  96.                have it), which in turn loads and runs BASPROG.BAS.  When
  97.                BASPROG issues a SYSTEM command, SIMCPM returns to AmigaDOS.
  98.  
  99.           simcpm -b mbasic basprog
  100.                Same as above, but with console output buffering.  Since
  101.                MBASIC does all console I/O one character at a time, the
  102.                buffered option can speed it up considerably.
  103.  
  104.      A trace version of the simulator, SIMCPMT, is included.  This program
  105. works like SIMCPM, but it provides optional instruction and BIOS/BDOS tracing.
  106. This is provided as a separate program because it must test whether to trace
  107. each instruction.  As a result, it runs slightly slower than SIMCPM, even when
  108. tracing is not active.
  109.  
  110.      Before running each program, SIMCPMT will prompt you for starting and
  111. ending addresses for tracing, and whether you want BIOS/BDOS calls traced.
  112. Simulation starts with tracing disabled.  When SIMCPM executes an instruction
  113. at the starting address, tracing is turned on.  All 8080 registers and the
  114. top four stack entries, as well as the current instruction, are displayed
  115. for each instruction until the ending address is reached.  Tracing is then
  116. disabled until the start address is again encountered.  After displaying
  117. 8 instructions, execution is suspended; enter G to go ahead with tracing
  118. disabled, Q to quit the program, or any other key to trace the next 8
  119. instructions.
  120.  
  121.      If you have requested BIOS/BDOS call tracing, the message
  122.  
  123.           BIOS CALL nn AT aaaa
  124. or
  125.           BDOS CALL nn AT aaaa
  126.  
  127. will be displayed each time a BIOS or BDOS call is made.  The BDOS call
  128. number (contents of register C in hex) will replace "nn" for BDOS calls,
  129. while BIOS calls will set "nn" to a sequential number starting at 01 for
  130. program termination, 02 for console status, etc.  The address where the
  131. call is made will be taken from the top of the stack and displayed in
  132. place of "aaaa".
  133.  
  134.      I have included two CP/M programs for demonstration purposes.
  135. TESTPROG.COM is a simple "hello, world" program (try it using SIMCPMT),
  136. while MANDOG.COM demonstrates cursor addressing for an emulated H19 terminal.
  137.  
  138.      SIMCPM consists of two source modules, SIMCPM1.ASM and SIMCPM2.ASM.
  139. The trace version, SIMCPMT, is made by re-assembling SIMCPM2 and including
  140. the header file SIMCPMT.HDR.  This file includes a definition of the label
  141. "tracehd"; SIMCPM2.ASM checks for this label using an IFD directive, and if
  142. it finds it the trace code is included.  Object modules for both versions
  143. (SIMCPM2.O and SIMCPM2T.O) are included.  The assembler must support an
  144. optional header file and the IFD directive.  No include files are needed,
  145. although AMIGA.LIB is required for linking.  The makefile is set up to use
  146. my own assembler, A68k, and BLink - it should be relatively easy to adapt it
  147. to whatever assembler and linker you are using.  Also, the makefile copies
  148. everything to my work disk as required (I do my actual work in RAM:), and
  149. does everything necessary to create both SIMCPM and SIMCPMT.
  150.  
  151.      Please address any kudos, flames, etc. to
  152.  
  153.           Charlie Gibbs
  154.           #21 - 21555 Dewdney Trunk Road
  155.           Maple Ridge, B.C.  V2X 3G6
  156.  
  157. or to Larry Phillips or Jeff Lydiatt on CompuServe or Usenet.  (I don't have
  158. the time or money to live there myself.)
  159.